package com.ouc.entity;

import lombok.Data;

/**
 * @Name: Triangle
 * @Description: 三角形
 * @Author: Mr.Tong
 */
@Data
public class Triangle extends Shape {
    //边一
    private Double edgeOne;
    //边二
    private Double edgeTwo;
    //边三
    private Double edgeThree;

    @Override
    public Double perimeter() {
        return edgeOne + edgeTwo + edgeThree;
    }

    @Override
    public Double area() {
        Double p = (edgeOne + edgeTwo + edgeThree) / 2;
        return Math.sqrt(p * (p - edgeOne) * (p - edgeTwo) * (p - edgeThree));
    }

    @Override
    public Integer unitAreaPrice() {
        return ShapeType.UNITAREAPRICE.get(3);
    }
}
